package cn.zktr.Personnel.controllers.zhouxiong;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.zktr.Personnel.model.pojos.PerCwaCwas;
import cn.zktr.Personnel.model.pojos.PerCwaShf;
import cn.zktr.Personnel.model.service.zhouxiong.JiChuService;

@Controller
public class BanCiController {
	@Autowired
	private JiChuService jichu;
	
	@RequestMapping("zx/ban-ci")
	public void zhujiemian() {
		
	}

	@RequestMapping("BanCixx")
	@ResponseBody
	public Map<String,Object> banci(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",jichu.selectBanCi().size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=jichu.selectBanCi();
		//页内容
		map.put("rows",findAll);
		return map;
	}
	
	@PostMapping("updateBC")
	@ResponseBody
	public String updateKQ(Integer shfid,String shfname,String shftime,String shfrem,HttpSession session) {
		String bc = jichu.updateBC( shfid, shfname, shftime, shfrem);
		return bc;
	}
	
	@PostMapping("deleteBC")
	@ResponseBody
	public String deleteBC(Integer shfid,HttpSession session) {
		jichu.deleteBC(shfid);
		return "";
	}
//	
//	public void kaoqin(HttpSession session) {
//		session.setAttribute("BanCi", jichu.selectBanCi());                     //班次
//	}
}
